package com.zxl.yjb.activity.my;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.zxl.yjb.R;
import com.zxl.yjb.base.BaseActivity;

public class UpdataNickNameActivity extends BaseActivity {

    private String old_nikename;
    private EditText etNickName;
    private ImageView ivBack;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_updata_nike_name);
        old_nikename = getIntent().getStringExtra("old_nick_name");
        initView();
        initEvent();
    }
    @Override
    protected void initView() {
        etNickName = findViewById(R.id.et_nick_name);
        TextView tvTile = findViewById(R.id.tv_page_title);
        ivBack = findViewById(R.id.iv_back);
        tvTile.setText(R.string.updata_nick_name);
        etNickName.setText(old_nikename);

    }
    private void initEvent() {
        ivBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String newNickName = etNickName.getText().toString().toString();
                if (!TextUtils.isEmpty(newNickName)) {
                    setResult(RESULT_OK,new Intent().putExtra("new_nick_name",newNickName));
                }
               finish();

            }
        });
    }



}
